<?php echo $header; ?>
<div id="main" class="container">
	<ul class="breadcrumb">
    	<?php $i=" >> ";foreach ($breadcrumbs as $breadcrumb) { ?>
    		<li><a href="<?php echo $breadcrumb['href']; ?>"><?php echo $breadcrumb['text'];if(!empty($i)){ echo $i;$i=""; }?></a></li>
    	<?php } ?>
  	</ul>
  	<div class="clear"></div>
    <div id="content" class="<?php echo $class; ?>">
        <div class="row">
            <h2 style="margin-bottom:10px;"> <span><?php echo $heading_title?>
				<a style='float: right;margin-top: -5px;margin-right:10px' href="javascript:share_facebook('<?php echo $url_sharefb?>')">
					<img src='<?php echo HTTP_SERVER."catalog/view/javascript/images/fb.png"?>' />
				</a></span>
			</h2>
            <div class="padding10">
                <?php if ($thumb || $images) { ?>
                    <ul class="thumbnails">
                        <?php if ($thumb) { ?>
                            <li class="img_default"><a class="thumbnail" <?php /*href="<?php echo $popup; ?>" */?> title="<?php echo $heading_title; ?>"><img src="<?php echo $thumb; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
                        <?php } ?>
                        <li> 
							
                            <div id="product">
                                <div class="form-group">
								<?php /*
                                <p class="price"><?php echo $price?></p>
                                <form action="">
                                  <input type="hidden" name="quantity" value="<?php echo $minimum; ?>" size="2" id="input-quantity" class="form-control" />
                                  <input type="hidden" name="product_id" value="<?php echo $product_id; ?>" />
                                  <button type="button" id="button-cart" data-loading-text="<?php echo $text_loading; ?>" class="btn btn-primary btn-lg btn-block"><?php echo $button_cart; ?></button>
                                 </form>
								 */?>
                                </div>
                            </div>
							
                        </li>
                        <?php /* if ($images) { ?>
                        <?php foreach ($images as $image) { ?>
                            <li class="image-additional"><a class="thumbnail" href="<?php echo $image['popup']; ?>" title="<?php echo $heading_title; ?>"> <img src="<?php echo $image['thumb']; ?>" title="<?php echo $heading_title; ?>" alt="<?php echo $heading_title; ?>" /></a></li>
                        <?php } ?>
                        <?php } */?>
                    </ul>
                    <div style="clear:both"></div>
                <?php } ?>
                <div class="tab-content">
                    <h3><span><?php echo $text_product_detail?></span></h3>
                    <div class="tab-pane active" id="tab-description"><?php echo $description; ?></div>
                </div>
                <?php if(!empty($products)){?>
                	<div class="frame_replated">
                        <h3><span><?php echo $text_replated?></span></h3>
                        <?php foreach($products as $product){?>
                            <a href="<?php echo $product["href"]?>">
                            <div class="product_replated">
                                    <p><img src='<?php echo $product["thumb"]?>' /> </p>
                                    <p><?php echo $product["name"]?></p>
                            </div>
                             </a>
                        <?php }?>
                   	</div>
                    <div class="clear"></div>
                <?php }?>
            </div>
        </div>
    </div>
</div>
<?php echo $footer; ?>
<script type="text/javascript"><!--
$('#button-cart').on('click', function() {
	$.ajax({
		url: 'index.php?route=checkout/cart/add',
		type: 'post',
		data: $('#product input[type=\'text\'], #product input[type=\'hidden\'], #product input[type=\'radio\']:checked, #product input[type=\'checkbox\']:checked, #product select, #product textarea'),
		dataType: 'json',
		beforeSend: function() {
			$('#button-cart').html('loading');
		},
		complete: function() {
			$('#button-cart').html('reset');
		},
		success: function(json) {
			$('.alert, .text-danger').remove();
			$('.form-group').removeClass('has-error');

			if (json['error']) {
				if (json['error']['option']) {
					for (i in json['error']['option']) {
						var element = $('#input-option' + i.replace('_', '-'));
						
						if (element.parent().hasClass('input-group')) {
							element.parent().after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						} else {
							element.after('<div class="text-danger">' + json['error']['option'][i] + '</div>');
						}
					}
				}
				
				if (json['error']['recurring']) {
					$('select[name=\'recurring_id\']').after('<div class="text-danger">' + json['error']['recurring'] + '</div>');
				}
				
				// Highlight any found errors
				$('.text-danger').parent().addClass('has-error');
			}
			
			if (json['success']) {
				$('.padding10').before('<div class="alert alert-success">' + json['success'] + '<button type="button" class="close" data-dismiss="alert">&times;</button></div>');
				
				$('#cart-total').html(json['total']);
				
				$('html, body').animate({ scrollTop: 0 }, 'slow');
				
				$('#cart > ul').load('index.php?route=common/cart/info ul li');
			}
		}
	});
});
//--></script> 